﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PMSGSC.Common;
using DevExpress.XtraEditors;
using PMSGSC.DAL;
using PMSGSC.BLL;
using DevExpress.XtraEditors.Repository;
using DevExpress.XtraEditors.Controls;
using System.Globalization;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Columns;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Data.Linq;
using DevExpress.Utils.OAuth.Provider;
using DevExpress.XtraRichEdit.Model;
using System.Diagnostics;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
using DevExpress.XtraGrid.Localization;
using DevExpress.XtraTab;
using DevExpress.XtraBars;

namespace PMSGSC.App
{
    public partial class rpStatusOfEquipment : DevExpress.XtraReports.UI.XtraReport
    {
        public rpStatusOfEquipment(List<Equipment> dataSource)
        {
            InitializeComponent();
            bindingSource1.DataSource = dataSource;
            xrLabel33.Text = DateTime.Now.Date.ToString("MM/dd/yyyy");
            OpenDocument();
        }

        private void OpenDocument()
        {
            string Address = Application.StartupPath + "\\Attachment\\";
            Directory.CreateDirectory(Address);
            if (null != bindingSource1.DataSource)
            {
                Equipment equip = bindingSource1.Cast<Equipment>().ToList()[0];
                string fileName = equip.Ship.NameShip + equip.Ship.Extension;
                Address += fileName;
                xrPictureBox1.ImageUrl = Address;
            }
        }
    }
}
